package com.example.testapp.activity.ui;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by l on 2016/8/24.
 */
public class SharedConfig {

    public static final String PREFERNCE_FILE_NAME = "obj"; // 缓存文件名

    public static final String USER_GUIDE_FILE_NAME = "guide";   //引导界面文件名

    //-----key-----
    public static final String KEY_USER_INFO = "user";

    //----collection----
    public static final String KEY_COLLECTION_INFO = "collection";  //收藏文件名

    /**
     * 判断是否进入引导界面
     *
     * @param context
     * @return
     */
    public static boolean getGuided(Context context) {
        SharedPreferences preferences = context.getSharedPreferences(USER_GUIDE_FILE_NAME, 0);
        boolean b = preferences.getBoolean("isguide", false);
        return b;
    }

    /**
     * 设置进入过引导界面
     *
     * @param context
     */
    public static void setGuided(Context context) {
        SharedPreferences preferences = context.getSharedPreferences(USER_GUIDE_FILE_NAME, 0);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putBoolean("isguide", true);
        editor.commit();
    }
}
